package com.xxwy.bean.alias;

import com.xxwy.bean.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 通过别名获取bean
 * @author wy
 * @date 2020/4/21 13:16
 */
public class Demo {

  public static void main(String[] args) {
    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/META-INF/bean-definition-context.xml");
    User user = applicationContext.getBean("user", User.class);
    User xxwy = applicationContext.getBean("xxwy", User.class);
    System.out.println(xxwy);
    System.out.println(user);
    //true
    System.out.println(user == xxwy);
  }
}
